@extends('generalAdmin.general-admin-layouts')
@section('style')
    <meta name="_token" content="{{ csrf_token() }}"/>
    <style>
        .trademark-th {
            text-align: center;
            color: #676767;
        }

        .trademark-td {
            text-align: center;
            color: #676767;
        }
    </style>
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap-datetimepicker.min.css')}}">
    <link rel="stylesheet" href="{{url('css/search.css')}}">
@stop
@section('content')
    <div class="content-wrapper" style="background-color: white">
        <section class="content">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="box box-info"
                         style="padding-top: 0px;margin-top: 0px;border-top: 0px;border-bottom: solid 1px #0080ff;">
                        <div class="box-body" style="">
                            <div class="row">
                                <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12" style="margin-top: 1%">
                                    <a href="{{url('generalAdmin/index')}}" title="返回首页" style="float: left"><i
                                                class="fa fa-home fa-2x"
                                                style="width: 100%;color: #009aff">
                                        </i></a>
                                    <a href="{{url('generalAdmin/patent')}}"><span
                                                style="font-size: 20px;float: left;color: #009aff">&nbsp;专利审阅</span></a>
                                    <div class="clear"></div>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12  col-lg-offset-8 col-md-offset-8">
                                    {{--<form action="{{url('Admin/generalAdmin/patentSearch')}}" method="post" enctype="multipart/form-data" class="search">--}}
                                        {{--{{csrf_field()}}--}}
                                        {{--<input type="search" id="search-input" name="search">--}}
                                        {{--<button class="fa fa-search fa-lg"></button>--}}
                                    {{--</form>--}}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            @include('public/alert')
            <div class="row">
                <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12">
                    <div class="small-box bg-aqua" style="background: #37A8F4">
                        <div class="inner" style="background: #37A8F4">
                            <h3>{{$result}}</h3>
                            <p>所有专利</p>
                        </div>
                        <div class="icon">
                            <img src="{{asset('admin_assets/img/patent_icon.png')}}"
                                 style="width: 100px;height: 100px;margin-left: 0;margin-top: -20px">
                        </div>
                        <a href="{{url('user/mine/myPatent')}}" class="small-box-footer"
                           style="background: #009aff">详情<i class="fa fa-arrow-circle-right"></i></a>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12">
                    <div class="small-box bg-aqua" style="background: #8BC44A">
                        <div class="inner" style="background: #8BC44A">
                            <h3>{{$result2}}</h3>
                            <p>委托专利</p>
                        </div>
                        <div class="icon">
                            <img src="{{asset('admin_assets/img/trademark_icon.png')}}"
                                 style="width: 100px;height: 100px;margin-left: 0;margin-top: -20px">
                        </div>
                        <a href="{{url('user/mine/myTrademark')}}" class="small-box-footer" style="background: #72aa49">详情<i
                                    class="fa fa-arrow-circle-right"></i></a>
                    </div>
                </div>
            </div>
            <div class="row" style="margin-left: 10px">
                <form class="form-inline" action="{{url('Admin/generalAdmin/patentCertainSearch')}}" method="post"
                      enctype="multipart/form-data">
                    {{csrf_field()}}
                    <div class="form-group">
                        <label for="exampleInputName2">申请人</label>
                        <input type="text" class="form-control" name="applicant" id="exampleInputName2" placeholder="申请人">
                    </div>
                    <label for="exampleInputName2">商标类型</label>
                    <select class="form-control" name="is_renew">
                        <option value=" " >不填</option>
                        <option value="0" >首次任务</option>
                        <option value="1" >续费任务</option>
                    </select>
                    <label for="exampleInputName2">类型</label>
                    <select class="form-control" name="second_type">
                        <option value=" " >不填</option>
                        <option value="1" >发明</option>
                        <option value="2" >实用新型</option>
                        <option value="3" >外观设计</option>
                    </select>
                    <div class="form-group">
                        <label for="exampleInputEmail2">专利号</label>
                        <input type="text" class="form-control" name="number" id="exampleInputEmail2" placeholder="专利号">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail2">名称</label>
                        <input type="text" class="form-control" name="product_name" id="exampleInputEmail2" placeholder="名称">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputName2">申请日期</label>
                        <input type="date" name="created_at" class="form-control" id="exampleInputName2" >
                    </div>
                    <div class="form-group">
                        <label for="exampleInputName2">授权日期</label>
                        <input type="date" name="authority_time" class="form-control" id="exampleInputName2" >
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail2">发明人</label>
                        <input type="text" class="form-control" name="inventor" id="exampleInputEmail2" placeholder="名称">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </div>
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th class="trademark-th">序号</th>
                                <th class="trademark-th">申请人</th>
                                <th class="trademark-th">专利类别</th>
                                <th class="trademark-th">类型</th>
                                <th class="trademark-th">专利号</th>
                                <th class="trademark-th">名称</th>
                                <th class="trademark-th">申请日期</th>
                                <th class="trademark-th">授权日期</th>
                                <th class="trademark-th">发明人</th>
                                <th class="trademark-th">代理人</th>
                                <th class="trademark-th">进度</th>
                                <th class="trademark-th">年费缴纳情况</th>
                                <th class="trademark-th">报件资料</th>
                                <th class="trademark-th">官方文件</th>
                                <th class="trademark-th">详情</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if($product->isEmpty())
                                <tr>
                                    <td colspan="15" style="text-align: center;color: #676767">暂无数据</td>
                                </tr>
                            @else
                                @foreach($product as $k => $v)
                                    @php($item=$v['Product'])
                                    <tr>
                                        <td class="trademark-td">{{$k+1}}</td>
                                        <td class="trademark-td">{{$item['applicant']}}</td>
                                        <td class="trademark-td">
                                            @if($v['is_renew']==0)
                                                首次任务
                                            @else
                                                续费任务
                                            @endif
                                            @if($v['urge']==1)
                                                <small class="label pull-right bg-red">催</small>
                                            @endif
                                        </td>
                                        <td class="trademark-td">{{$v['SecondType']['name']}}</td>
                                        <td class="trademark-td">{{$item['number']}}</td>
                                        <td class="trademark-td">{{$item['name']}}</td>
                                        <td class="trademark-td">{{$v['created_at']}}</td>
                                        <td class="trademark-td">{{$item['authority_time']}}</td>
                                        <td class="trademark-td">{{$item['inventor']}}</td>
                                        <td class="trademark-td">{{$v['agent']}}</td>
                                        <td class="trademark-td">{{$progress[$v['progress_list_id']]['name']}}</td>
                                        <td class="trademark-td"></td>
                                        <td class="trademark-td">
                                            @if(empty($item['file']))
                                                未上传
                                            @else
                                                <a href="{{asset('Uploads/resources/'.$item['file'])}}">
                                                    下载资料
                                                </a>
                                            @endif
                                        </td>
                                        <td class="trademark-td">
                                            @if($item['is_download_notice']!=0)
                                                <a href="javascript:void(0);" product="{{$item['id']}}"
                                                   onclick="ajxZip($(this))">下载资料</a>
                                            @endif
                                        </td>
                                        <td class="trademark-td">
                                            <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}">查看详情</a>
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    </div>
@stop
@section('javascript')
    <script>
        function ajxZip(e) {
            $.ajax({
                url: '{{url("Admin/generalAdmin/ajxZip")}}',
                type: 'post',
                dataType: "json",
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                },
                data: {
                    'id': e.attr('product')
                },
                success: function (data) {
                    if (data == "0") {
                        alert("暂无附件资料");
                    } else {
                        window.location.href = data;
                    }
                }
            });
        }
    </script>

@stop
